<!--
描述：直播模块-直播视频添加
开发人：zhaohang
开发日期：2019年12月25日
-->
<template lang="pug">
  kalix-dialog.user-add(title='添加' bizKey="liveVideo" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="课程名称" prop="name"  v-bind:rules="rules.name")
        el-input(v-model="formModel.name")
      el-form-item(label="老师名称" prop="teacher"  v-bind:rules="rules.teacher")
        el-input(v-model="formModel.teacher")
      el-form-item(label="课程简介" prop="classIntroduce"  v-bind:rules="rules.classIntroduce")
        el-input(v-model="formModel.classIntroduce" type="textarea" v-bind:rows="3")
      el-form-item.short(label="视频" prop="video"  v-bind:rules="rules.video")
        kalix-clansman-upload-video(:action="action" v-on:filePath="getFilePathVideo" fileType="video" :limit="1"  :fileList="fileList" tipText="只能上传视频文件" ref="upload")
</template>

<script type="text/ecmascript-6">
  import {liveVideoURL} from '../../config.toml'
  import {videoUpdateURL, videoEchoUpdateURL} from '../../../../../config/global.toml'
  import FormModel from './model'
  import KalixClansmanUploadVideo from '../../../../../components/fileUpload/uploadvideo'

  export default {
    name: 'liveVideoAdd',
    components: {KalixClansmanUploadVideo},
    data() {
      return {
        action: videoUpdateURL + ':3200/upload',
        formModel: Object.assign({}, FormModel),
        rules: {
          name: [{required: true, message: '请输入课程名称', trigger: 'change'}],
          teacher: [{required: true, message: '请输入教师名称', trigger: 'change'}],
          classIntroduce: [{required: true, message: '请输入课程简介', trigger: 'change'}],
          video: [{required: true, message: '请上传视频', trigger: 'change'}]
        },
        targetURL: liveVideoURL,
        options: [],
        items: [],
        fileList: []
      }
    },
    methods: {
      getFilePathVideo(filePath, fileName) {
        console.log('000000000000filePath, fileName000000000000000000', filePath, fileName)
        this.formModel.video = videoEchoUpdateURL + fileName
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
